package toanstt.com.gameplay;

import toanstt.com.MatchUp.Button;
import toanstt.com.MatchUp.MainActivity;
import toanstt.com.MatchUp.Notice;
import toanstt.com.MatchUp.SCR;
import toanstt.com.MatchUp.Sound2;
import toanstt.com.MatchUp.T;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.MotionEvent;

public class Keys 
{
	int minx,miny,height,width;
	public Button[] buttons;
	int d;
	int temp_x,temp_y;
	int action, actionCode;
	public Keys()
	{
		minx = T.PANEL_MINX;
		miny = T.PANEL_MINY;
		height = width = T.DISPLAY_WIDTH - minx;
		buttons = new Button[16];
		float half = T.BUT_HEIGHT/2;
		int index =0;
		
		int i,j;
		if(T.ISHORIZONTAL)
		{
			/*if(T.DISPLAY_WIDTH < 400)
			{
				miny = 0;
				
				T.BUT_WIDTH = T.BUT_HEIGHT = (T.DISPLAY_HEIGHT - 50)/6; 
				for( i =0;i<6;i++)
				{
					for( j =0;j<3;j++)
					{
						//buttons[i*4+j] = new Button(T.TBITMAP_KEYS.bitmap[i*4+j], (int)(minx + i*T.BUT_HEIGHT ), (int)(miny + j*T.BUT_HEIGHT ));
						buttons[index] = new Button(T.TBITMAP_KEYS.bitmap[index], (int)(minx + j*T.BUT_HEIGHT ), (int)(miny + i*T.BUT_HEIGHT ));
						index++;
						if(index ==16)
							break;
					}
				}
			}
			else*/
			{
				for( i =0;i<4;i++)
				{
					for( j =0;j<4;j++)
					{
						//buttons[i*4+j] = new Button(T.TBITMAP_KEYS.bitmap[i*4+j], (int)(minx + i*T.BUT_HEIGHT ), (int)(miny + j*T.BUT_HEIGHT ));
						buttons[index] = new Button(T.TBITMAP_KEYS.bitmap[index], (int)(minx + j*T.BUT_HEIGHT ), (int)(miny + i*T.BUT_HEIGHT ));
						index++;
					}
				}
			}
		}
		else
		{
			for( i =0;i<2;i++)
			{
				for( j =0;j<8;j++)
				{
					//buttons[i*4+j] = new Button(T.TBITMAP_KEYS.bitmap[i*4+j], (int)(minx + i*T.BUT_HEIGHT ), (int)(miny + j*T.BUT_HEIGHT ));
					buttons[index] = new Button(T.TBITMAP_KEYS.bitmap[index], (int)(minx + j*T.BUT_HEIGHT ), (int)(miny + i*T.BUT_HEIGHT ));
					index++;
				}
			}
		}
//		i=4;j=0;
//		buttons[12]  =  new Button(T.TBITMAP_KEYS.bitmap[12], (int)(minx + j*T.BUT_HEIGHT ), (int)(miny + i*T.BUT_HEIGHT ));
//		j=1;
//		buttons[13]  =  new Button(T.TBITMAP_KEYS.bitmap[14], (int)(minx + j*T.BUT_HEIGHT ), (int)(miny + i*T.BUT_HEIGHT ));
//		j=2;
//		buttons[14]  =  new Button(T.TBITMAP_KEYS.bitmap[15], (int)(minx + j*T.BUT_HEIGHT ), (int)(miny + i*T.BUT_HEIGHT ));
	}
	public void Draw(Canvas canvas)
	{
		T.paint.setColor(Color.WHITE);
		for(d =0;d<16;d++)
		{
			
			buttons[d].Draw2(canvas);
			
		}
		
	}
	int t;
	int but_index;

	public void ResetAllAlpla()
	{
		for(t=0;t<16;t++)
			buttons[t].anpla = 255;
	}
}
